package com.sinog.biz.interceptor;

import com.sinog.biz.config.ProvinceCodesConfig;
import com.sinog.biz.util.CodeUrlUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @desc 读取yml配置文件获取当前部署省份code - 工具类
 * @author lzq
 * @date 2021-04-08 13:56
 */
@Component
public class CodesHelper implements InitializingBean {

    private static CodesHelper codesHelper;
    @Autowired
    private ProvinceCodesConfig provinceCodesConfig;
    @Autowired
    private CodeUrlUtils codeUrlUtils;

    /**
     * 描述
     */
    @Override
    public void afterPropertiesSet() {
        codesHelper = this;
    }

    /**
     * 描述
     * @return ProvinceCodesConfig
     */
    public static ProvinceCodesConfig getInstance() {
        return codesHelper.provinceCodesConfig;
    }

    /**
     * 描述
     * @return CodeUrlUtils
     */
    public static CodeUrlUtils getCodeUrlUtils() {
        return codesHelper.codeUrlUtils;
    }
}